marker new
new
: compLit ( n -- )
  compile lit , ;

: postpone ( "<spaces>name" -- )
  >in @ >r
  state @ 0= abort" POSTPONE: Illegal in interpretation state"
  bl word find ?dup if
    \ found
    1+ if
      \ immediate
      ,
    else
      \ non-immediate
      compile compile ,
    then
  else
    \ not found
    drop  r@ >in !
    bl word number if
      \ not a number
      r@ >in !
      cr ." POSTPONE: " bl word type ."  not found, " 
      ." in " latest @ 2+ dup @ 15 and swap 2+ swap type cr
      blk @ ?dup if ." in block #" . ." line " >in @ 64 / .
      then abort
    else
      \ it's a number
      $A052 @ if swap compile lit , compile compLit then
      compile lit , compile compLit
    then
  then
  r> drop 
; immediate




Quotations: ANS

: [:
  postpone 0
  postpone if
  here $8320 ,
; immediate

: ;]
  postpone exit
  >r postpone then
  r> postpone lit ,
; immediate

: test 1 2 [: 3 ;] 4 ;
see test



Quotations: Forth-83
: [:
  compile lit 0 ,
  [compile] if
  here $8320 ,
; immediate

: ;]
  compile exit
  >r [compile] then
  r> compile lit ,
; immediate

: test 1 2 [: 3 ;] ;
see test



: compLit ( n -- ) compile lit , ;
: postpone ( "<spaces>name" -- ) >in @ >r
state @ 0= abort" POSTPONE: Illegal in interpretation state"
bl word find ?dup if 1+ if , else compile compile , then
else drop  r@ >in ! bl word number if r@ >in ! cr 
." POSTPONE: " bl word type ."  not found, " ." in " latest @ 2+
 dup @ 15 and swap 2+ swap type cr blk @ ?dup if ." in block #"
. ." line " >in @ 64 / . then abort else $A052 @ if swap compile
lit , compile compLit then compile lit , compile compLit then 
then r> drop ; immediate